﻿@model IEnumerable<LynxWebLog.PostData>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.dateCreated)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.license)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CommentsClosed)
        </th>
    </tr>

@foreach (var item in Model) {
    @if (item.IsPublished) { 
    <tr>
        <td>
            @Html.ActionLink(item.title, "Post", "Blog", new { id = item.title }, null)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.dateCreated)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.license)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CommentsClosed)
        </td>
    </tr>
    }
}

</table>
